package com.woniu.user.controller;

import com.woniu.common.entity.*;
import com.woniu.user.feign.DogBreedFeign;
import com.woniu.user.feign.PunishComplainNoticeFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author author
 * @create 2021/5/27
 */

@RestController
@RequestMapping("/convenient")
public class ConvenientController {

    @Autowired
    PunishComplainNoticeFeign adoptFeign;

    @Autowired
    DogBreedFeign dogBreedFeign;

    //远程调用查询犬种库
    @RequestMapping("/getAllDogBreedBySize")
    public ResponseResult<List<DogBreed>> getAllDogBreed(Integer size){

        System.out.println(dogBreedFeign.getAllDogBreed(size));

        return dogBreedFeign.getAllDogBreed(size);

    };


    //远程调用修改状态
    @RequestMapping("/updateStatus")
    public ResponseResult<String> updateStatus(Integer id){

        return adoptFeign.updateStatus(id);
    }

    //远程调用领养申请
    @PostMapping("/apply")
    public ResponseResult<String> addAdoptApply(@RequestBody AdoptApply adoptApply){
        return adoptFeign.addAdoptApply(adoptApply);
    }

    //远程调用领养信息
    @RequestMapping("/findAllAdopt")
    public PageResult<Adopt> findAllAdopt(Integer page, Integer size){


        return adoptFeign.findAllAdopt(page, size);
    }

}
